<?$gn = Group::group_names();?>
<style>
  .form_err {color:red; font-size: 90%; font-style:italic}
</style>
    
<div style="margin:10px">

    
    <div class="div_form">
        <h1>Users management</h1>
        <div>
            <a href="index.php?m=administration">Users list</a> | Create new user
        </div>
        
        <?if($error):?><div class="error">Something wrong!</div><?endif?>    
        <form class="form" action="index.php?m=administration&a=create_user&s=submit" method="POST" style="margin: 10px 30px;">
            <table>
                <tr>
                    <td> Username: </td>
                    <td>        
                        <?if(isset($error['user_name'])):?><div class="form_err"><?=$error['user_name']?></div><?endif?>
                        <input type="text" name="user_name" value="<?=$data['user_name']?>">
                    </td>
                </tr>
                <tr>
                    <td> Password:</td>
                    <td>         
                        <?if(isset($error['user_password'])):?><div class="form_err"><?=$error['user_password']?></div><?endif?>
                        <input type="text" name="user_password" value="<?=$data['user_password']?>">
                    </td>
                </tr>
                <tr>
                    <td>
                        User email:
                    </td>
                    <td>
                            <?if(isset($error['user_email'])):?><div class="form_err"><?=$error['user_email']?></div><?endif?>
                            <input type="text" name="user_email" value="<?=$data['user_email']?>">
                    </td>
                </tr>
                <tr>
                    <td>
                        Real name:
                    </td>
                    <td>
                        <input type="text" name="user_realname" value="<?=$data['user_realname']?>">
                    </td>
                </tr>
                
                <tr>
                    <td>
                        Group:
                    </td>
                    <td>
                        <select name="group_id">
                            <option value="0">-Select-</option>
                            <?foreach($gn as $gid=>$n):?>
                            <?$selected=($gid==$data['group_id'])?'selected':''?>
                            <option value="<?=$gid?>"  <?=$selected?>><?=$n?></option>
                            <?endforeach?>
                        </select> 
                    </td>
                </tr>

            </table>

        
  
        <p><input type="submit" value="Create User"><br/></p>
        </form>
    </div>   
</div>

<style>

td
{
padding:7px;
}
</style>